package com.xiaoer.studyenglishdemo.ui;

import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

import com.xiaoer.studyenglishdemo.R;
import com.xiaoer.studyenglishdemo.util.WordsLoader;

public class MainActivity extends AppCompatActivity {
    Button btn1, btn2, btn3, btn4;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        WordsLoader.initWords(this);

        btn1 = findViewById(R.id.btn1);
        btn2 = findViewById(R.id.btn2);
        btn3 = findViewById(R.id.btn3);
        btn4 = findViewById(R.id.btn4);


        // 英语学习
        btn1.setOnClickListener(v -> {
            Intent intent = new Intent(MainActivity.this, EnglishStudyActivity.class);
            startActivity(intent);
        });

        // 英语训练
        btn2.setOnClickListener(v -> {
            WordsTrainActivity.startMe(this, WordsLoader.getAllWords(this), true);
        });

        // 英语测试
        btn3.setOnClickListener(v -> {
            WordsTrainActivity.startMe(this, WordsLoader.getShufflesWords(this, 10), false);
        });

        // 新增单词
        btn4.setOnClickListener(v -> {
            AddWordActivity.startMe(this);
        });
    }
}